import { defineStore } from 'pinia'
import { ref } from 'vue'
import { getConfig } from '~/api'

export const useAppStore = defineStore('app', () => {
  const config = ref({})
  const path = ref({})

  async function initConfig() {
    const res = await getConfig()
    if (res.code === 0)
      config.value = res.data
  }

  return {
    config,
    path,
    initConfig,
  }
}, {
  persist: true,
})
